import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'pang_rowth_plugin_platform_interface.dart';

/// An implementation of [PangRowthPluginPlatform] that uses method channels.
class MethodChannelPangRowthPlugin extends PangRowthPluginPlatform {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  final methodChannel = const MethodChannel('pang_rowth_plugin');

  @override
  Future<String?> getPlatformVersion() async {
    final version =
        await methodChannel.invokeMethod<String>('getPlatformVersion');
    return version;
  }

  @override
  Future<bool> init({
    String? djxJson,
    String? novJson,
  }) async {
    final result = await methodChannel.invokeMethod<bool>('init', {
      'DJXJson': djxJson,
      'NOVJson': novJson,
    });
    return result ?? false;
  }

  @override
  Future<bool> loadDJX() async {
    final result = await methodChannel.invokeMethod<bool>('loadDJX');
    return result ?? false;
  }
}
